# -*- coding: utf-8 -*-
"""
Version: 0.1
Author: CarpeDiem
Date: 2022/9/6
Description: 查找指定年份之后的图书信息
"""

import pymysql
import datetime

# 连接 MySQL
conn = pymysql.connect(host='localhost',
                       user='root',
                       password='root',
                       database='book_management',
                       charset="utf8")
cursor = conn.cursor()

sql_show = "select * from books"
cursor.execute(sql_show)
#print(cursor.fetchall())

for row in cursor.fetchall():
    if row[3] < 70 and row[4] > datetime.date(2016, 12, 31):
        print("图书：《%s》,价格：￥%s元 ,出版日期：%s" % (row[1], row[3], row[4]))

cursor.close()
conn.close()